package cn.bo.cloud.demo1.web;


import cn.bo.cloud.demo1.feign.DemoServer2Feign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/client")
public class ClientController {

    @Autowired
    private DemoServer2Feign demoServer2Feign;
//    private RestTemplate restTemplate;

    @Value("${server.port}")
    String port;

    @RequestMapping("/uri1")
    public String test01(){
//        String forObject = restTemplate.getForObject("http://demo-server-2/server/uri1", String.class);
        String forObject = demoServer2Feign.test01();
        return "client-u1-" + port + "-" + forObject;

    }

    @RequestMapping("/uri2")
    public String test02(){

        return "client-u2";
    }

}
